package com.example.shop_2302

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.example.base.mvvm.BaseActivity
import com.example.shop_2302.databinding.ActivityMainBinding
import com.example.shop_2302.userInfo.UserViewModel

@Route(path = "/app/MainActivity")
class MainActivity : BaseActivity<ActivityMainBinding,UserViewModel>() {
    override fun initView() {
        viewModel.user()
        //点击编辑图标，跳转到对应界面
        binding.userEdit.setOnClickListener {
            ARouter.getInstance().build("/app/EditActivity").navigation()
        }

    }

    override fun initData() {
        viewModel.userSuccess.observe(this){
            if(it.code==200){
                binding.info = it.data
            }
        }

    }

    override fun getViewModel(): Class<UserViewModel> = UserViewModel::class.java

    override fun getLayout(): Int  = R.layout.activity_main

}